﻿using System.Text.RegularExpressions;

namespace HuaCheng.Model
{
    
    public class Util
    {
        /// <summary>
        /// 验证邮箱格式
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public static bool IsEmail(string email)
        {
            bool EmailFlag = false;
            Regex re = new Regex(@"[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?");//实例化一个Regex对象
            if (re.IsMatch(email) == true)//验证数据是否匹配
            {
                EmailFlag = true;
            }
            return EmailFlag;
        }
    }
}
